package com.chaoyong.higo.adapter;

import com.chaoyong.higo.R;
import com.chaoyong.higo.base.BaseAdapter;
import com.chaoyong.higo.utils.ViewHolder;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * “最新揭晓”页面中的排序
 * @author zk
 *
 */
public class NewsetSortAdapter extends BaseAdapter<Object> {
	
	private String[] itemsName = {"全部分类","手机数码","电脑办公","家用电器","化妆个护","钟表首饰","其他商品"};
	private int[] draws = {R.drawable.newest_sort_0,
			R.drawable.newest_sort_1,
			R.drawable.newest_sort_2,
			R.drawable.newest_sort_3,
			R.drawable.newest_sort_4,
			R.drawable.newest_sort_5,
			R.drawable.newest_sort_6};
	
	private TextView newset_sort_tv;

	public NewsetSortAdapter(Context context) {
		super(context);
	}
	
	@Override
	public int getCount() {
		return itemsName.length;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.item_newset_sort, null);
		}
		Drawable drawable = mContext.getResources().getDrawable(draws[position]);
		drawable.setBounds(0,0,drawable.getMinimumWidth(),drawable.getMinimumHeight());
		
		newset_sort_tv = ViewHolder.get(convertView, R.id.newset_sort_tv);
		
		newset_sort_tv.setText(itemsName[position]);
		newset_sort_tv.setCompoundDrawables(drawable,null,null,null);
		
		return convertView;
	}

}
